<div id="content">
	<!-- widget grid -->
    <section widget-grid id="widget-grid">

        <div class="row">
            <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div jarvis-widget data-widget-editbutton="false" data-widget-color="darken">
                    <header>
                     <h2>用户列表</h2>
                    </header>
                    <div>
                        <div class="widget-body-toolbar">
                            <div class="row">
								 <div class="pull-left margin-right-20">
                                    <a class="btn btn-labeled btn-primary" data-toggle="modal" data-target="#addModal"> <span class="btn-label"><i class="glyphicon glyphicon-plus"></i></span>添加用户</a>
                                </div>
                            </div>
                        </div>
                        <div class="widget-body no-padding">

                            <div class="table-responsive">

                                <table class="table table-bordered table-striped table-condensed table-hover smart-form">
                                    <thead>
                                        <tr>
                                            <th>操作</th>
                                            <th>账号</th>
                                            <th>名字</th>
                                            <th>角色</th>
                                            <th>创建人账号</th>
                                            <th>创建时间</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-repeat="user in users">
                                            <td>
                                              <button class='btn btn-xs btn-default' uib-tooltip='编辑' tooltip-append-to-body='true' ng-click="showEditDevice(user)"  ng-disabled="observer"><i class='fa fa-pencil'></i></button>
                                              <button class='btn btn-xs btn-default' uib-tooltip='删除' tooltip-append-to-body='true' ng-click="showDelDialog(user.id)" ng-disabled="observer"><i class='fa fa-times'></i></button>
                                            </td>
                                            <td>{{user.id}}</td>
                                            <td>{{user.name}}</td>
                                            <td>{{user.role_name}}</td>
                                            <td>{{user.fid}}</td>
                                            <td>{{user.timefrom}}</td>
                                        </tr>
                                    </tbody>
                                </table>
                               
                            </div>
                            <div class="dt-toolbar-footer">
                                <tm-pagination conf="paginationConf"></tm-pagination>
                            </div>
                        </div>
                    </div>
                    
                </div>
            </article>
        </div>
    </section>
   
</div>


<!-- Modal -->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">添加用户</h4>
            </div>
            <div class="modal-body">

                <form id="smart-form-register" class="smart-form" data-smart-registration-form ng-submit="insertdata()">
                    <fieldset class="row">
                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">账号</label>
                            <label class="input">
                                <input type="text" maxlength="50" required="required" ng-model="insert.id">
                            </label>
                        </section>

                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">姓名</label>
                            <label class="input">
                                <input type="text" maxlength="50" required="required" ng-model="insert.name">
                            </label>
                        </section>
                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">客户名称</label>
                            <label class="input">
                                <input type="text" maxlength="50" required="required" ng-model="insert.clientname">
                            </label>
                        </section>
                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">手机号码</label>
                            <label class="input">
                                <input type="text" maxlength="50" required="required" ng-model="insert.tele">
                            </label>
                        </section>
                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">角色id</label>
                            <label class="select">
                                <select name="" id="" ng-model="insert.roleid">
                                    <option ng-repeat="role in roles" value="{{role.id}}">{{role.name}}</option>
                                </select>
                            </label>
                        </section>
                       
                    </fieldset>

                    <footer>

                        <button type="button" class="btn btn-default" data-dismiss="modal">
                            关闭
                        </button>
                        <button type="submit" class="btn btn-primary">
                            提交
                        </button>

                    </footer>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">编辑用户</h4>
            </div>
            <div class="modal-body">

                <form id="smart-form-register" class="smart-form" data-smart-registration-form ng-submit="updatedata()">
                    <fieldset class="row">
                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">账号</label>
                            <label class="input">
                                <input type="text" maxlength="50" required="required" ng-model="editdata.id">
                            </label>
                        </section>

                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">姓名</label>
                            <label class="input">
                                <input type="text" maxlength="50" required="required" ng-model="editdata.name">
                            </label>
                        </section>
                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">客户名称</label>
                            <label class="input">
                                <input type="text" maxlength="50" required="required" ng-model="editdata.clientname">
                            </label>
                        </section>
                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">手机号码</label>
                            <label class="input">
                                <input type="text" maxlength="50" required="required" ng-model="editdata.tele">
                            </label>
                        </section>
                        <section class="col-sm-5" style="margin: 0 20px 15px;">
                            <label class="label">角色id</label>
                            <label class="select">
                                <select name="" id="" ng-model="editdata.roleid">
                                    <option ng-repeat="role in roles" value="{{role.id}}">{{role.name}}</option>
                                </select>
                            </label>
                        </section>
                       
                    </fieldset>

                    <footer>

                        <button type="button" class="btn btn-default" data-dismiss="modal">
                            关闭
                        </button>
                        <button type="submit" class="btn btn-primary">
                            提交
                        </button>

                    </footer>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div class="modal fade" id="showDelDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    ×
                </button>
                <h4 class="modal-title">信息</h4>
            </div>
            <div class="modal-body">
                <p>
                    您确实要删除这个用户吗？
                </p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">
                    关闭
                </button>
                <button type="button" class="btn btn-primary" ng-click="deldevice()">
                    删除用户
                </button>
            </div>
        </div>
    </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->